<template>
	<view class="wrap">
		<u-navbar :title="$t('csmx')" title-width="340" :border-bottom="false" back-icon-color="#fff" title-color="#fff" :background="{ backgroundColor: '#0030A8' }"></u-navbar>
		<view class="tom-container">
			<view class="cell">
				<view class="cell_Title">
					{{$t('zsy')}}
				</view>
				<view class="cell_Data">
					-999999
					<text class="text">USDT</text>
				</view>
				<view class="cell_tiem">
					2021-10-9  11:40
					<text class="text">{{$t('ybc')}}</text>
				</view>
			</view>
			<view class="api_block">
				<view class="block_top">
					<view class="block_top_item">
						<image class="img" src="/static/jinbi.png" ></image>
						<text class="text">{{$t('bizhong')}}</text>
					</view>
					<view class="block_top_item">
						<image class="img" src="/static/shijian.png"></image>
						<text class="text">{{$t('shijian')}}</text>
					</view>
					<view class="block_top_item">
						<image class="img" src="/static/zhuanqian-.png"></image>
						<text class="text">{{$t('ykje')}}</text>
					</view>
				</view>
				<view style="overflow: auto;flex: 1;">
					<mescroll-uni  :fixed="false" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
						<view class="list" v-for="(item,index) in list" :key="index" @tap="toPay(item)">
							<view>
							XXXX/USDT	
							</view>
							<view>
							XXXX/USDT	
							</view>
							<view class="red">
							XXXX/USDT	
							</view>
						</view>
					</mescroll-uni>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
import {mapState,mapGetters} from 'vuex';
export default {
	mixins: [MescrollMixin],
	data() {
		return {
			list:[],
			bindIP:'',
		};
	},
	methods: {
		toPay(item){
			uni.setStorageSync('bindIP', this.bindIP);
			this.$store.commit('saveShortData',item);
			uni.navigateTo({
				url: '/pages/User/apiManage/bingding/bingding'
			});
			
		},
		// 下拉刷新
		downCallback(){
			this.mescroll.resetUpScroll()
		},
		// 上拉加载
		upCallback(page){
			uni.showLoading({
				mask: true,
				title: this.$t('loading.title')
			});
			this.$api.userApi
				.getExchanges()
				.then(res => {
					this.bindIP = res.data.bindIP;
					let list=res.data.exchangeList || [];
					this.mescroll.endSuccess(list.length)
					if(page.num == 1) this.list = []; //如果是第一页需手动制空列表
					this.list=this.list.concat(list); //追加新数据
					uni.hideLoading();
				}).catch(res =>{
					uni.hideLoading();
				})
		},
	}
};
</script>

<style lang="scss" scoped>
.tom-container {
	.cell{
		height: 280rpx;
		border-radius: 8rpx;
		background-image: url('/static/CalculateU.png');
		background-position: left bottom;
		background-repeat: no-repeat;
		background-size: 100% 100%;
		margin: 60rpx 30rpx 30rpx 30rpx;
		text-align: center;
		color: #fff;
		position: relative;
		.cell_Title{
			font-size: 36rpx;
			margin-top: 42rpx;
			margin-bottom: 16rpx;
		}
		.cell_Data{
			font-size: 48rpx;
			font-weight: bold;
			.text{
				margin-left: 20rpx;
				font-size: 38rpx;
				font-weight: 500;
			}
			
		}
		.cell_tiem{
			width: 100%;
			font-size: 30rpx;
			font-weight: bold;
			color: $tom-text-red;
			position: absolute;
			bottom: 20rpx;
			.text{
				margin-left: 30rpx;
			}
		}
	}
	.api_block{
		flex: 1;
		display: flex;
		flex-direction: column;
		background-color: #fff;
		margin: $nr-padd;
		border-radius: 20rpx;
		.block_top{
			display: flex;
			align-items: center;
			justify-content: space-between;
			border-bottom:2rpx solid #F2F2F2;
			padding: 24rpx 0rpx;
			.block_top_item{
				display: flex;
				align-items: center;
				width: 100%;
				justify-content: center;
				.img{
					width: 28rpx;
					height: 30rpx;
					margin-right: 5px;
				}
				.text{
					font-size: 30rpx;
					font-weight: bold;
				}
			}
		}
		.list{
			display: flex;
			align-items: center;
			justify-content:space-between;
			border-bottom: 2rpx solid $page-bg;
			padding: 20rpx 30rpx;
			font-size: 28rpx;
			.red{
				color: $tom-text-red;
			}
			.green{
				color: $tom-text-green;
			}
		}
	}
}
</style>
